#include <iostream>
#include <list>
#include <vector>
#include <algorithm>
#include <array>
#include <time.h>
#include <queue>
#include <stack>
#include <string>
#include <set>
#include <map>
#include <functional>
#include <chrono>
using namespace std;

#include "RBTree.h"
 
int main()
{
	const int N = 10000000;
	vector<int> v;
	v.reserve(N);
	srand(time(0));
	for (size_t i = 0; i < N; i++)
	{
		v.push_back(i);
	}

	RBTree<int, int> rbt;
	auto start = std::chrono::high_resolution_clock::now();
	for (auto e : v)
	{
		rbt.Insert(make_pair(e, e));
	}
	auto end = std::chrono::high_resolution_clock::now();

	std::chrono::duration<double> elapsed_time = end - start;
	std::cout << "Elapsed time: " << elapsed_time.count() << " seconds" << std::endl; // 3.59

	cout << " RBTree: isBalance:" << rbt.IsRBTree() << endl;	 // 1
	cout << " RBTree: height:" << rbt.Height() << endl;			 // 44
	cout << " RBTree: rotateCount:" << rbt._rotateCount << endl; // 1kw数据旋转900w次

	return 0;
}